
<meta charset="utf-8">
<div class="box" id="biz_pmpWeekly_conatainer">
	<div class="box-header with-border">
		<form id="searchForm" role="form" class="form-inline">
			<div class="form-group">
				<label>所属年</label> <input name="weeklyYear"
					v-model="searchForm.weeklyYear" id="weeklyYear" type="text"
					placeholder="" class="form-control">
			</div>
			<div class="form-group">
				<label>所属周</label> <input name="weekNum"
					v-model="searchForm.weekNum" id="weekNum" type="number"
					min="1" max="52"
					placeholder="" class="form-control">
			</div>
			<div class="form-group">
				<label>周报状态</label> <select id="status" name="status"
					v-model="searchForm.status" class=" form-control">
					<option value="0">未提交</option>
					<option value="1">已提交</option>
					<option value="2">已评阅</option>
				</select>
			</div>
			<button type="button" class="btn btn-info pull-right m-t-n-xs"
				v-on:click="search">
				<strong>查询</strong>
			</button>
		</form>
	</div>
	<div class="box-body">
		<div class="row">
			<div class="col-md-12">
				<div class="btn-group " id="pmpWeeklyTableToolbar" role="group">
					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="add">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 添加
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="edit">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>修改
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="submit">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 提交
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="comment">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 评阅
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="deletex">
						<i class="glyphicon glyphicon-trash" aria-hidden="true"></i> 删除
					</button>
				</div>
				<table id="pmpWeeklyBootstrapTable" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
</div>
<script>
new Vue({  
	  el: '#biz_pmpWeekly_conatainer',
	  data:{
		  searchForm:{
			  creatorUserId : null,
			  weeklyYear : null,
			  weekNum : null,
			  status : null
		  },
		  bus:new Vue(),
	  },
	  mounted:function(){
		  var _this=this;
		  //var param=zfesLayerEditDg.getLayerParam();//projectId projectVersionId  
		  _this.initTable();
	  },
    methods: {
  	  initTable:function(){
  		var _this=this;
 
  		var columns=[
  					{checkbox:true},
  					{field:'creator_user_name',title:'创建者',width:160,sortable:true},
  					{field:'userType',title:'成员类型',width:160,formatter:_this.formatType},
  					{field:'weekly_year',title:'年数',width:100},
  					{field:'week_num',title:'周数',width:100},
					{field:'this_week_summary',title:'本周总结',width:60},
					{field:'next_week_plan',title:'下周计划',width:100},
					{field:'this_week_remark',title:'备注',width:100},
  					{field:'pm_comment',title:'经理评价',width:100},
  					{field:'status',title:'状态',width:100,formatter:_this.formatStatus}];
  					
  		  
  		  
  		  var url="/pmp/service/pub/pmpWeekly/loadPmpWeeklyDataSet";
    		zfesBstable.laodTable($("#pmpWeeklyBootstrapTable"),$("#searchForm"),$("#pmpWeeklyTableToolbar"),url,columns,this.searchForm);
  	  },
  	  search:function(){
  		  zfesBstable.reload($("#pmpWeeklyBootstrapTable")); 
  	  },
  	  refresh:function(){
  		  zfesBstable.refresh($("#pmpWeeklyBootstrapTable"));
  	  },
  	  add:function(){
  	    var　_this=this;
		var url="/views/pmpWeekly/pmpWeekly.add.html";
		zfesLayerEditDg.open(url,{},"添加周报",660,function(){_this.refresh();}); 
		 
  	},
  	  edit:function(){
  		  if(zfesBstable.isOneRow($("#pmpWeeklyBootstrapTable"))){
  			  var　_this=this;
  			  var id=zfesBstable.getRowId($("#pmpWeeklyBootstrapTable"));
  			  var url="/views/pmpWeekly/pmpWeekly.edit.html";
  			  zfesLayerEditDg.open(url,{"id":id},"周报编辑",600,function(){_this.refresh();}); 
  		 }
  	  },
  	 submit:function(){
		  if(zfesBstable.isOneRow($("#pmpWeeklyBootstrapTable"))){
			  var　_this=this;
			  var id=zfesBstable.getRowId($("#pmpWeeklyBootstrapTable"));
			  alertSwal.confirm("提交","是否提交该周报",function(){
				    var ajaxUrl = "/pmp/service/pub/pmpWeekly/submitPmpWeekly";
					zfesAjax.ajaxTodo(ajaxUrl, { "id" : id}, function(data) {
						alertSwal.successText(data.message);
						_this.refresh();
					}); 
		 });
		 }
	  },
	  comment:function(){
  		  if(zfesBstable.isOneRow($("#pmpWeeklyBootstrapTable"))){
  			  var　_this=this;
  			  var id=zfesBstable.getRowId($("#pmpWeeklyBootstrapTable"));
  			  var url="/views/pmpWeekly/pmpWeekly.comment.html";
  			  zfesLayerEditDg.open(url,{"id":id},"经理评阅",600,function(){_this.refresh();}); 
  		 }
  	  },
  	  deletex:function(){
  			if(zfesBstable.isSelectedRow($("#pmpTasksBootstrapTable"))){
  				  var　_this=this;
  				    var id=zfesBstable.getRowId($("#pmpTasksBootstrapTable"));
  					//var ids=zfesBstable.getRowIds($("#cloudMemberBootstrapTable"));
  					 alertSwal.confirm("删除","是否删除该周报",function(){
  						    var ajaxUrl = "/pmp/service/pub/pmpWeekly/deletePmpWeekly";
  							zfesAjax.ajaxTodo(ajaxUrl, { "id" : id}, function(data) {
  								alertSwal.successText(data.message);
  								_this.refresh();
  							}); 
  				});
  			}
  				
  	  },
  	  formatType:function(value, row, index){
  		if("1"==value){return '[开发人员]';}else if("2"==value){return '[测试人员]';}else if("3"==value){return '[项目经理]';}else{return '[管理人员]';}
  	},
  	 formatStatus:function(value, row, index){
   		if("0"==value){return '[未提交]';}else if("1"==value){return '[已提交]';}else{return '[已评阅]';}
   	}
   	
   }

});
</script>


